<template>
  <div class="component-projectList">
    <div class="component-mainHeader">
      <div class="top">
        <div class="topleft">
          <p>
            <span class="iconfont" style="color:#1abc9a;margin-right:3px;">&#xe607;</span>项目列表
          </p>
        </div>
        <div class="topright">
          <el-button type="info" @click="$router.go(0)">
            <span style="font-weight:700;margin-right:5px;" class="iconfont">&#xe662;</span>刷新
          </el-button>
        </div>
      </div>
    </div>
    <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick" class="tabs-header">
      <el-tab-pane label="全部项目" name="first">
        <div class="component-searchHeader">
          <div class="search-header">
            <div class="left-title">
              <p class="left-text">
                <span class="iconfont" style="font-weight:700">&#xe63d;</span>筛选查询
              </p>
              <div class="right">
                <button @click="searchInfo()">查询</button>
              </div>
            </div>
          </div>
        </div>

        <div class="component-search-box">
          <el-form :inline="true" :model="projectSearch" class="demo-form-inline">
            <el-form-item label="输入搜索：">
              <el-input
                v-model="projectSearch.info"
                placeholder="项目名称/项目编号"
                clearable
                style="width:217px;"
              ></el-input>
            </el-form-item>
            <el-form-item label="项目状态：">
              <el-select
                v-model="projectSearch.progress"
                placeholder="请选择项目状态"
                clearable
                style="width:217px;"
              >
                <el-option
                  v-for="item in progress"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="施工队类型：" style="width:330px;">
              <el-select
                v-model="projectSearch.type"
                placeholder="请选择施工队类型"
                clearable
                style="width:217px;"
              >
                <el-option label="管道" value="1"></el-option>
                <el-option label="线路" value="2"></el-option>
                <el-option label="设备" value="3"></el-option>
                <el-option label="熔纤" value="4"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="开始日期：">
              <el-date-picker
                v-model="projectSearch.date"
                type="date"
                placeholder="选择日期"
                format="yyyy 年 MM 月 dd 日"
                value-format="timestamp"
                style="width:217px;"
                default-time="00:00:00"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="所属合同：">
              <el-input
                v-model="projectSearch.conName"
                placeholder="请输入所属合同"
                clearable
                style="width:217px;"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>

        <div class="component-listHeader">
          <div class="search-header">
            <div class="left-title">
              <p class="left-text">
                <span class="iconfont">&#xe61e;</span>
                全部项目列表
              </p>
              <div class="right">
                <el-button
                  @click="$router.push({name:'buildPro',params:{isFrom:'projectList'}})"
                >添加项目</el-button>
              </div>
            </div>
          </div>
        </div>

        <div class="table">
          <el-table
            ref="multipleTable"
            :data="projectInfo"
            tooltip-effect="dark"
            style="width: 1100px;margin:0 auto"
            border
          >
            <el-table-column label="项目编号" align="center" width="120" prop="proNo"></el-table-column>
            <el-table-column label="所属单项合同" align="center" width="120" prop="conName"></el-table-column>
            <el-table-column label="项目名称" align="center" width="110" prop="proName"></el-table-column>
            <el-table-column label="开始时间" align="center" width="90" prop="sworkDate">
              <template slot-scope="scope">{{scope.row.sworkDate|timeFilter}}</template>
            </el-table-column>
            <el-table-column label="截止时间" align="center" width="90" prop="eworkDate">
              <template slot-scope="scope">{{scope.row.eworkDate|timeFilter}}</template>
            </el-table-column>
            <el-table-column label="涉及施工类型" align="center" width="145" prop="majorType"></el-table-column>
            <el-table-column label="项目状态" align="center" width="100" prop="proProgress"></el-table-column>
            <el-table-column label="工作量审核状态" align="center" width="110" prop="flowStep"></el-table-column>
            <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                <el-button
                  @click="handleCheck(scope.row.proId)"
                  type="text"
                  size="small"
                  class="red"
                >查看详情</el-button>
                <el-button
                  @click="goAmap"
                  v-show="scope.row.proProgress == '未立项' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >预算绘图</el-button>
                <el-button
                  @click="handleSendOrder(scope.row.proId,scope.row.majorType)"
                  v-show="scope.row.proProgress == '未派单'&& ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >派单</el-button>
                <el-button
                  @click="handleChangeOrder(scope.row.majorType,scope.row.proId)"
                  v-show="scope.row.proProgress == '未进场' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >改派</el-button>
                <el-button
                  @click="handleWorkCheck(scope.row.proId)"
                  v-show="scope.row.flowStep == '施工队提交审核' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >工作量审核</el-button>
                <el-button
                  @click="handleWorkCheck(scope.row.proId)"
                  v-show="scope.row.flowStep == '项目部文员审核通过' && ms_roleName == 'ProjectManager'"
                  type="text"
                  size="small"
                  class="red"
                >工作量审核</el-button>
                <el-button
                  @click="handleWorkTotal(scope.row.proId)"
                  v-show="scope.row.proProgress == '工作量审核' && ms_roleName != 'ProjectManager' && ms_roleName != 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >工作量统计</el-button>
                <!-- 管理部文员 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterClerk' && scope.row.flowStep == '项目部经理初审通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部副总 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterDeputy' && scope.row.flowStep == '管理部文员通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部财务经理 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterFinanceManager' && scope.row.flowStep == '管理部副总通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部总经理 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterBOSS' && scope.row.flowStep == '管理部财务审核'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <el-button
                  @click="handleReturn(scope.row.proId)"
                  v-show="scope.row.proProgress == '工作量审核' && ms_roleName == 'ProjectWarehouse'"
                  type="text"
                  size="small"
                  class="red"
                >提醒退料</el-button>
                <el-button
                  @click="$router.push({name:'handInfoos',query:{row:scope.row.proId}})"
                  v-show="scope.row.proProgress == '待交工'"
                  type="text"
                  size="small"
                  class="red"
                >生成交工资料</el-button>
                <!-- <el-button
                  @click="makeBudget(scope.row.proId)"
                  v-show="ms_roleName == 'ProjectClerk'&&
                  (( scope.row.proProgress == '工作量审核' && (scope.row.flowStep == '总经理通过'||scope.row.flowStep == '管理部副总通过'||scope.row.flowStep == '管理部财务通过'))||scope.row.proProgress == '验收' )"
                  type="text"
                  size="small"
                  class="red"
                >生成预结算</el-button>-->
                <el-button
                  @click="$router.push({name:'makeFinalCost',query:{proId:scope.row.proId,proType:'1'}})"
                  v-show="ms_roleName == 'ProjectClerk'&&
  (( scope.row.proProgress == '工作量审核' && (scope.row.flowStep == '总经理通过'||scope.row.flowStep == '管理部副总通过'||scope.row.flowStep == '管理部财务通过'))||scope.row.proProgress == '验收' )"
                  type="text"
                  size="small"
                  class="red"
                >生成预结算</el-button>
                <el-button
                  @click="openFile(scope.row.proId)"
                  type="text"
                  size="small"
                  class="red"
                  v-show="scope.row.proProgress == '送审结算'"
                >归档</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="component-paging" v-show="projectInfo.length>0">
          <div class="table-bottom">
            <div class="bottom-left"></div>
            <div class="paging">
              <div class="paging-left">
                <p>
                  共
                  <span>{{Math.ceil(Page.RowCount/Page.PageSize)}}</span> 页/
                  <span>{{Page.RowCount}}</span> 条数据
                </p>
              </div>
              <el-pagination
                background
                @size-change="SizeChange($event,projectInit,Page.CurrentPage,Page.PageSize)"
                @current-change="CurrentChange($event,projectInit,Page.CurrentPage,Page.PageSize)"
                :current-page.sync="Page.CurrentPage"
                :page-sizes="[10, 20, 30]"
                :page-size.sync="Page.PageSize"
                layout="sizes, prev, pager, next, jumper"
                :total="Page.RowCount"
              ></el-pagination>
            </div>
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane label="已竣工" name="second">
        <div class="component-searchHeader">
          <div class="search-header">
            <div class="left-title">
              <p class="left-text">
                <span class="iconfont" style="font-weight:700">&#xe63d;</span>筛选查询
              </p>
              <div class="right">
                <button @click="searchInfo()">查询</button>
              </div>
            </div>
          </div>
        </div>

        <div class="component-search-box">
          <el-form :inline="true" :model="projectSearch" class="demo-form-inline">
            <el-form-item label="输入搜索：">
              <el-input
                v-model="projectSearch.info"
                placeholder="项目名称/项目编号"
                clearable
                style="width:217px;"
              ></el-input>
            </el-form-item>
            <el-form-item label="项目状态：">
              <el-select
                v-model="projectSearch.progress"
                placeholder="请选择项目状态"
                clearable
                style="width:217px;"
              >
                <el-option
                  v-for="item in progress"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="施工队类型：" style="width:330px;">
              <el-select
                v-model="projectSearch.type"
                placeholder="请选择施工队类型"
                clearable
                style="width:217px;"
              >
                <el-option label="管道" value="1"></el-option>
                <el-option label="线路" value="2"></el-option>
                <el-option label="设备" value="3"></el-option>
                <el-option label="熔纤" value="4"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="开始日期：">
              <el-date-picker
                v-model="projectSearch.date"
                type="date"
                placeholder="选择日期"
                format="yyyy 年 MM 月 dd 日"
                value-format="timestamp"
                style="width:217px;"
                default-time="00:00:00"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="所属合同：">
              <el-input
                v-model="projectSearch.conName"
                placeholder="请输入所属合同"
                clearable
                style="width:217px;"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>

        <div class="component-listHeader">
          <div class="search-header">
            <div class="left-title">
              <p class="left-text">
                <span class="iconfont">&#xe61e;</span>
                全部项目列表
              </p>
              <div class="right">
                <el-button
                  @click="$router.push({name:'buildPro',params:{isFrom:'projectList'}})"
                >添加项目</el-button>
              </div>
            </div>
          </div>
        </div>

        <div class="table">
          <el-table
            ref="multipleTable"
            :data="projectInfo"
            tooltip-effect="dark"
            style="width: 1100px;margin:0 auto"
            border
          >
            <el-table-column label="项目编号" align="center" width="120" prop="proNo"></el-table-column>
            <el-table-column label="所属单项合同" align="center" width="120" prop="conName"></el-table-column>
            <el-table-column label="项目名称" align="center" width="110" prop="proName"></el-table-column>
            <el-table-column label="开始时间" align="center" width="90" prop="sworkDate">
              <template slot-scope="scope">{{scope.row.sworkDate|timeFilter}}</template>
            </el-table-column>
            <el-table-column label="截止时间" align="center" width="90" prop="eworkDate">
              <template slot-scope="scope">{{scope.row.eworkDate|timeFilter}}</template>
            </el-table-column>
            <el-table-column label="涉及施工类型" align="center" width="145" prop="majorType"></el-table-column>
            <el-table-column label="项目状态" align="center" width="100" prop="proProgress"></el-table-column>
            <el-table-column label="工作量审核状态" align="center" width="110" prop="flowStep"></el-table-column>
            <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                <el-button
                  @click="handleCheck(scope.row.proId)"
                  type="text"
                  size="small"
                  class="red"
                >查看详情</el-button>
                <el-button
                  @click="goAmap"
                  v-show="scope.row.proProgress == '未立项' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >预算绘图</el-button>
                <el-button
                  @click="handleSendOrder(scope.row.proId,scope.row.majorType)"
                  v-show="scope.row.proProgress == '未派单' &&ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >派单</el-button>
                <el-button
                  @click="handleChangeOrder(scope.row.majorType,scope.row.proId)"
                  v-show="scope.row.proProgress == '未进场' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >改派</el-button>
                <el-button
                  @click="handleWorkCheck(scope.row.proId)"
                  v-show="scope.row.flowStep == '施工队提交审核' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >工作量审核</el-button>
                <el-button
                  @click="handleWorkCheck(scope.row.proId)"
                  v-show="scope.row.flowStep == '项目部文员审核通过' && ms_roleName == 'ProjectManager'"
                  type="text"
                  size="small"
                  class="red"
                >工作量审核</el-button>
                <el-button
                  @click="handleWorkTotal(scope.row.proId)"
                  v-show="scope.row.proProgress == '工作量审核' && ms_roleName != 'ProjectManager' && ms_roleName != 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >工作量统计</el-button>
                <!-- 管理部文员 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterClerk' && scope.row.flowStep == '项目部经理初审通过' "
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部副总 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterDeputy' && scope.row.flowStep == '管理部文员通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部财务经理 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterFinanceManager' && scope.row.flowStep == '管理部副总通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部总经理 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterBOSS' && scope.row.flowStep == '管理部财务审核'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <el-button
                  @click="handleReturn(scope.row.proId)"
                  v-show="scope.row.proProgress == '工作量审核' && ms_roleName == 'ProjectWarehouse'"
                  type="text"
                  size="small"
                  class="red"
                >提醒退料</el-button>
                <el-button
                  @click="$router.push({name:'handInfoos',query:{row:scope.row.proId}})"
                  v-show="scope.row.proProgress == '待交工'"
                  type="text"
                  size="small"
                  class="red"
                >生成交工资料</el-button>
                <!-- <el-button
                  @click="makeBudget(scope.row.proId)"
                  v-show="ms_roleName == 'ProjectClerk'&&
                  (( scope.row.proProgress == '工作量审核' && (scope.row.flowStep == '总经理通过'||scope.row.flowStep == '管理部副总通过'||scope.row.flowStep == '管理部财务通过'))||scope.row.proProgress == '验收' )"
                  type="text"
                  size="small"
                  class="red"
                >生成预结算</el-button>-->
                <el-button
                  @click="$router.push({name:'makeFinalCost',query:{proId:scope.row.proId,proType:'1'}})"
                  v-show="ms_roleName == 'ProjectClerk'&&
  (( scope.row.proProgress == '工作量审核' && (scope.row.flowStep == '总经理通过'||scope.row.flowStep == '管理部副总通过'||scope.row.flowStep == '管理部财务通过'))||scope.row.proProgress == '验收' )"
                  type="text"
                  size="small"
                  class="red"
                >生成预结算</el-button>
                <el-button
                  @click="openFile(scope.row.proId)"
                  type="text"
                  size="small"
                  class="red"
                  v-show="scope.row.proProgress == '送审结算'"
                >归档</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="component-paging" v-show="projectInfo.length>0">
          <div class="table-bottom">
            <div class="bottom-left"></div>
            <div class="paging">
              <div class="paging-left">
                <p>
                  共
                  <span>{{Math.ceil(Page.RowCount/Page.PageSize)}}</span> 页/
                  <span>{{Page.RowCount}}</span> 条数据
                </p>
              </div>
              <el-pagination
                background
                @size-change="SizeChange($event,projectInit,Page.CurrentPage,Page.PageSize)"
                @current-change="CurrentChange($event,projectInit,Page.CurrentPage,Page.PageSize)"
                :current-page.sync="Page.CurrentPage"
                :page-sizes="[10, 20, 30]"
                :page-size.sync="Page.PageSize"
                layout="sizes, prev, pager, next, jumper"
                :total="Page.RowCount"
              ></el-pagination>
            </div>
          </div>
        </div>
      </el-tab-pane>
      <el-tab-pane label="施工中" name="third">
        <div class="component-searchHeader">
          <div class="search-header">
            <div class="left-title">
              <p class="left-text">
                <span class="iconfont" style="font-weight:700">&#xe63d;</span>筛选查询
              </p>
              <div class="right">
                <button @click="searchInfo()">查询</button>
              </div>
            </div>
          </div>
        </div>

        <div class="component-search-box">
          <el-form :inline="true" :model="projectSearch" class="demo-form-inline">
            <el-form-item label="输入搜索：">
              <el-input
                v-model="projectSearch.info"
                placeholder="项目名称/项目编号"
                clearable
                style="width:217px;"
              ></el-input>
            </el-form-item>
            <el-form-item label="项目状态：">
              <el-select
                v-model="projectSearch.progress"
                placeholder="请选择项目状态"
                clearable
                style="width:217px;"
              >
                <el-option
                  v-for="item in progress"
                  :key="item.value"
                  :label="item.name"
                  :value="item.value"
                ></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="施工队类型：" style="width:330px;">
              <el-select
                v-model="projectSearch.type"
                placeholder="请选择施工队类型"
                clearable
                style="width:217px;"
              >
                <el-option label="管道" value="1"></el-option>
                <el-option label="线路" value="2"></el-option>
                <el-option label="设备" value="3"></el-option>
                <el-option label="熔纤" value="4"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="开始日期：">
              <el-date-picker
                v-model="projectSearch.date"
                type="date"
                placeholder="选择日期"
                format="yyyy 年 MM 月 dd 日"
                value-format="timestamp"
                style="width:217px;"
                default-time="00:00:00"
              ></el-date-picker>
            </el-form-item>
            <el-form-item label="所属合同：">
              <el-input
                v-model="projectSearch.conName"
                placeholder="请输入所属合同"
                clearable
                style="width:217px;"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>

        <div class="component-listHeader">
          <div class="search-header">
            <div class="left-title">
              <p class="left-text">
                <span class="iconfont">&#xe61e;</span>
                全部项目列表
              </p>
              <div class="right">
                <el-button
                  @click="$router.push({name:'buildPro',params:{isFrom:'projectList'}})"
                >添加项目</el-button>
              </div>
            </div>
          </div>
        </div>

        <div class="table">
          <el-table
            ref="multipleTable"
            :data="projectInfo"
            tooltip-effect="dark"
            style="width: 1100px;margin:0 auto"
            border
          >
            <el-table-column label="项目编号" align="center" width="120" prop="proNo"></el-table-column>
            <el-table-column label="所属单项合同" align="center" width="120" prop="conName"></el-table-column>
            <el-table-column label="项目名称" align="center" width="110" prop="proName"></el-table-column>
            <el-table-column label="开始时间" align="center" width="90" prop="sworkDate">
              <template slot-scope="scope">{{scope.row.sworkDate|timeFilter}}</template>
            </el-table-column>
            <el-table-column label="截止时间" align="center" width="90" prop="eworkDate">
              <template slot-scope="scope">{{scope.row.eworkDate|timeFilter}}</template>
            </el-table-column>
            <el-table-column label="涉及施工类型" align="center" width="145" prop="majorType"></el-table-column>
            <el-table-column label="项目状态" align="center" width="100" prop="proProgress"></el-table-column>
            <el-table-column label="工作量审核状态" align="center" width="110" prop="flowStep"></el-table-column>
            <el-table-column label="操作" align="center">
              <template slot-scope="scope">
                <el-button
                  @click="handleCheck(scope.row.proId)"
                  type="text"
                  size="small"
                  class="red"
                >查看详情</el-button>
                <el-button
                  @click="goAmap"
                  v-show="scope.row.proProgress == '未立项' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >预算绘图</el-button>
                <el-button
                  v-show="scope.row.proProgress == '未派单'&& ms_roleName == 'ProjectClerk'"
                  @click="handleSendOrder(scope.row.proId,scope.row.majorType)"
                  type="text"
                  size="small"
                  class="red"
                >派单</el-button>
                <el-button
                  @click="handleChangeOrder(scope.row.majorType,scope.row.proId)"
                  v-show="scope.row.proProgress == '未进场' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >改派</el-button>
                <el-button
                  @click="handleWorkCheck(scope.row.proId)"
                  v-show="scope.row.flowStep == '施工队提交审核' && ms_roleName == 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >工作量审核</el-button>
                <el-button
                  @click="handleWorkCheck(scope.row.proId)"
                  v-show="scope.row.flowStep == '项目部文员审核通过' && ms_roleName == 'ProjectManager'"
                  type="text"
                  size="small"
                  class="red"
                >工作量审核</el-button>
                <el-button
                  @click="handleWorkTotal(scope.row.proId)"
                  v-show="scope.row.proProgress == '工作量审核' && ms_roleName != 'ProjectManager' && ms_roleName != 'ProjectClerk'"
                  type="text"
                  size="small"
                  class="red"
                >工作量统计</el-button>
                <!-- 管理部文员 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterClerk' && scope.row.flowStep == '项目部经理初审通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部副总 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterDeputy' && scope.row.flowStep == '管理部文员通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部财务经理 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterFinanceManager' && scope.row.flowStep == '管理部副总通过'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <!-- 管理部总经理 -->
                <el-button
                  @click="handleIdea(scope.row.proId)"
                  v-show="ms_roleName == 'CenterBOSS' && scope.row.flowStep == '管理部财务审核'"
                  type="text"
                  size="small"
                  class="red"
                >同意</el-button>
                <el-button
                  @click="handleReturn(scope.row.proId)"
                  v-show="scope.row.proProgress == '工作量审核' && ms_roleName == 'ProjectWarehouse'"
                  type="text"
                  size="small"
                  class="red"
                >提醒退料</el-button>
                <el-button
                  @click="$router.push({name:'handInfoos',query:{row:scope.row.proId}})"
                  v-show="scope.row.proProgress == '待交工'"
                  type="text"
                  size="small"
                  class="red"
                >生成交工资料</el-button>
                <!-- <el-button
                  @click="makeBudget(scope.row.proId)"
                  v-show="ms_roleName == 'ProjectClerk'&&
                  (( scope.row.proProgress == '工作量审核' && (scope.row.flowStep == '总经理通过'||scope.row.flowStep == '管理部副总通过'||scope.row.flowStep == '管理部财务通过'))||scope.row.proProgress == '验收' )"
                  type="text"
                  size="small"
                  class="red"
                >生成预结算</el-button>-->
                <el-button
                  @click="$router.push({name:'makeFinalCost',query:{proId:scope.row.proId,proType:'1'}})"
                  v-show="ms_roleName == 'ProjectClerk'&&
  (( scope.row.proProgress == '工作量审核' && (scope.row.flowStep == '总经理通过'||scope.row.flowStep == '管理部副总通过'||scope.row.flowStep == '管理部财务通过'))||scope.row.proProgress == '验收' )"
                  type="text"
                  size="small"
                  class="red"
                >生成预结算</el-button>
                <el-button
                  @click="openFile(scope.row.proId)"
                  type="text"
                  size="small"
                  class="red"
                  v-show="scope.row.proProgress == '送审结算'"
                >归档</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
        <div class="component-paging" v-show="projectInfo.length>0">
          <div class="table-bottom">
            <div class="bottom-left"></div>
            <div class="paging">
              <div class="paging-left">
                <p>
                  共
                  <span>{{Math.ceil(Page.RowCount/Page.PageSize)}}</span> 页/
                  <span>{{Page.RowCount}}</span> 条数据
                </p>
              </div>
              <el-pagination
                background
                @size-change="SizeChange($event,projectInit,Page.CurrentPage,Page.PageSize)"
                @current-change="CurrentChange($event,projectInit,Page.CurrentPage,Page.PageSize)"
                :current-page.sync="Page.CurrentPage"
                :page-sizes="[10, 20, 30]"
                :page-size.sync="Page.PageSize"
                layout="sizes, prev, pager, next, jumper"
                :total="Page.RowCount"
              ></el-pagination>
            </div>
          </div>
        </div>
      </el-tab-pane>
    </el-tabs>
    <!--改派弹框-->
    <div class="component-models">
      <el-dialog title="改派" :visible.sync="dialogChoose" width="660px">
        <el-form :model="changeOrder" ref="changeOrder" label-width="200px" class="demo-ruleForm">
          <el-form-item label="选择施工类型:">
            <el-select
              v-model="changeOrder.type"
              placeholder="请选择施工类型"
              style="width:217px;"
              @change="getOldTeam"
            >
              <el-option
                v-for="item in changeOrder.options"
                :key="item.label"
                :label="item.label"
                :value="item.label"
              ></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="当前施工队:">
            <span style="float: left;">{{changeOrder.oldTeam.orgName}}</span>
          </el-form-item>
          <el-form-item label="当前状态:">
            <span style="float: left;">{{changeOrder.oldTeam.acceptStatus}}</span>
          </el-form-item>
          <el-form-item label="接单时间:">
            <span style="float: left;">{{changeOrder.oldTeam.acceptDate|dateFilter}}</span>
          </el-form-item>
          <el-form-item label="备注:">
            <span style="float: left;">{{changeOrder.oldTeam.dispatchRemark}}</span>
          </el-form-item>
          <el-form-item label="改派:">
            <el-select v-model="changeOrder.chooseTeam" placeholder="请选择改派施工队">
              <el-option
                v-for="item in changeOrder.teams"
                :key="item.orgId"
                :label="item.orgName"
                :value="item.orgId"
              ></el-option>
            </el-select>
          </el-form-item>
        </el-form>
        <span slot="footer" class="dialog-footer">
          <el-button @click="dialogChoose = false">取消</el-button>
          <el-button @click="submitChangeOrder()">提交</el-button>
        </span>
      </el-dialog>
    </div>
    <!-- 审批意见 -->
    <div class="component-model">
      <el-dialog title="审核意见" :visible.sync="ideaModel.show" width="600px">
        <div class="hadRadio">
          <el-form
            ref="form"
            :model="ideaModel"
            label-width="100px"
            style="width:300px;margin:0 auto;"
          >
            <el-form-item label="审核意见：">
              <el-radio-group v-model="ideaModel.idea" style="margin-left:-30px;">
                <el-radio label="true">同意</el-radio>
                <el-radio label="false">驳回</el-radio>
              </el-radio-group>
            </el-form-item>
            <el-form-item label="备注：" style="width:300px;">
              <el-input type="textarea" v-model="ideaModel.remark" style="margin-left:20px;"></el-input>
            </el-form-item>
          </el-form>
        </div>
        <span slot="footer" class="dialog-footer">
          <el-button @click="ideaModel.show = false">取消</el-button>
          <el-button @click="ideaCommit">确定</el-button>
        </span>
      </el-dialog>
    </div>
    <!--预结算-->
    <div class="component-budgetModel">
      <div class="baseModel">
        <el-dialog title="预结算" :visible.sync="baseConfig" width="800px">
          <el-tabs
            v-model="budgetTabName"
            type="border-card"
            @tab-click="budgetTabClick"
            class="tabs-header"
          >
            <el-tab-pane label="设置基础参数" name="first">
              <!-- 设置基础参数 -->
              <div class="ticket_top">
                <el-form
                  :model="baseConfigInfo"
                  ref="baseConfigForm"
                  label-width="160px"
                  style="width:350px;margin:20px auto;"
                  :rules="rules"
                >
                  <el-form-item label="跳纤点数量：" prop="skipfiber" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.skipfiber" style="width:200px;"></el-input>
                  </el-form-item>
                  <el-form-item label="施工折扣率：" prop="workDiscount" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.workDiscount" style="width:200px;"></el-input>
                  </el-form-item>
                  <el-form-item label="SLA点数是否超时：" prop="slaTimeout" style="margin-bottom:20px;">
                    <el-select
                      v-model="baseConfigInfo.slaTimeout"
                      placeholder="请选择"
                      style="width:200px;"
                      clearable
                    >
                      <el-option label="是" value="1"></el-option>
                      <el-option label="否" value="0"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="施工单位税率：" prop="taxRate" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.taxRate" style="width:200px;"></el-input>
                  </el-form-item>
                  <el-form-item label="零星材料/资料录入：" prop="materialInput" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.materialInput" style="width:200px;"></el-input>
                  </el-form-item>
                  <el-form-item
                    label="设计院是否出图："
                    prop="disignerProvider"
                    style="width: 163px;margin-bottom:20px;"
                  >
                    <el-select
                      v-model="baseConfigInfo.disignerProvider"
                      placeholder="请选择"
                      style="width:200px;"
                      clearable
                    >
                      <el-option label="是" value="1"></el-option>
                      <el-option label="否" value="0"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item
                    label="是否家宽："
                    prop="homeBroadband"
                    style="width: 163px;margin-bottom:20px;"
                  >
                    <el-select
                      v-model="baseConfigInfo.homeBroadband"
                      placeholder="请选择"
                      style="width:200px;"
                      clearable
                    >
                      <el-option label="是" value="1"></el-option>
                      <el-option label="否" value="0"></el-option>
                    </el-select>
                  </el-form-item>
                  <el-form-item label="勘察费：" prop="surveyCost" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.surveyCost" style="width:200px;"></el-input>
                  </el-form-item>
                  <el-form-item label="预算降点数：" prop="dropPoint" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.dropPoint" style="width:200px;"></el-input>
                  </el-form-item>
                  <!-- <el-form-item label="设计费降点数：" prop="calc">
                <el-input v-model="baseConfigInfo.sell" style="width:200px;"></el-input>
                  </el-form-item>-->
                  <!-- <el-form-item label="监理费降点数：" prop="calc">
                <el-input v-model="baseConfigInfo.sell" style="width:200px;"></el-input>
                  </el-form-item>-->
                  <el-form-item label="大型施工机械吨数：" prop="macTon" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.macTon" style="width:200px;"></el-input>
                  </el-form-item>
                  <el-form-item label="总户数：" prop="totalHouse" style="margin-bottom:20px;">
                    <el-input v-model="baseConfigInfo.totalHouse" style="width:200px;"></el-input>
                  </el-form-item>
                </el-form>
                <div>
                  <el-button @click="submitForm('baseConfigForm')">保存基础参数</el-button>
                </div>
              </div>
            </el-tab-pane>
            <el-tab-pane name="third" label="工作量">
              <div class="fl_container">
                <div class="fl_left"></div>
                <div class="fl_right">
                  <!-- 表三按钮 -->
                  <el-button
                    v-show="budgetTabName=='third'"
                    @click="edit(3)"
                  >{{editBtn?'进行编辑':'取消编辑'}}</el-button>
                  <el-button
                    style="width:70px;"
                    v-show="budgetTabName=='third'"
                    @click="commit(3)"
                  >保存</el-button>
                </div>
              </div>
              <div class="table">
                <el-table
                  ref="multipleTable"
                  :data="thirdInfo"
                  tooltip-effect="dark"
                  style="width: 700px;margin:0 auto"
                  border
                >
                  <el-table-column label="项目名称" align="center" prop="budgetItemName">
                    <!-- <template slot-scope="scope">
                <el-input size="small" v-model="scope.row.budgetItemName" :disabled="thirdFlag"></el-input>
                    </template>-->
                  </el-table-column>
                  <el-table-column label="单位" align="center" width="100" prop="quotaUnit">
                    <!-- <template slot-scope="scope">
                <el-input size="small" v-model="scope.row.quotaUnit" :disabled="thirdFlag"></el-input>
                    </template>-->
                  </el-table-column>
                  <el-table-column label="数量" align="center" width="100" prop="num">
                    <template slot-scope="scope">
                      <el-input size="small" v-model="scope.row.num" :disabled="thirdFlag"></el-input>
                    </template>
                  </el-table-column>
                </el-table>
              </div>
            </el-tab-pane>
            <el-tab-pane name="fourth">
              <el-dropdown slot="label" trigger="hover" @command="handleCommand1">
                <span class="el-dropdown-link">
                  器材预算（表四）
                  <i class="el-icon-arrow-down el-icon--right"></i>
                </span>
                <el-dropdown-menu slot="dropdown" style="width:150px;">
                  <el-dropdown-item command="甲供设备">甲供设备</el-dropdown-item>
                  <el-dropdown-item command="甲供主材">甲供主材</el-dropdown-item>
                  <el-dropdown-item command="乙供主材">乙供主材</el-dropdown-item>
                </el-dropdown-menu>
              </el-dropdown>
              <div class="fl_container">
                <div class="fl_left">{{fourthTitle}}</div>
                <div class="fl_right">
                  <!-- 表四按钮 -->
                  <el-button
                    v-show="budgetTabName=='fourth'"
                    @click="edit(4)"
                  >{{editBtn?'进行编辑':'取消编辑'}}</el-button>
                  <el-button
                    style="width:70px;"
                    v-show="budgetTabName=='fourth'"
                    @click="commit(4)"
                  >保存</el-button>
                </div>
              </div>
              <div class="table">
                <el-table
                  ref="multipleTable"
                  :data="fourthInfo"
                  tooltip-effect="dark"
                  style="width: 700px;margin:0 auto"
                  border
                >
                  <el-table-column label="主要材料" align="center" width="200" prop="typeName"></el-table-column>
                  <el-table-column label="规格程式" align="center" prop="mat"></el-table-column>
                  <el-table-column label="单位" align="center" width="80" prop="matUnit"></el-table-column>
                  <el-table-column label="数量" align="center" width="150" prop="num">
                    <template slot-scope="scope">
                      <el-input
                        size="small"
                        type="number"
                        min="0"
                        v-model="scope.row.num"
                        :disabled="fourthFlag"
                      ></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="单价(元)"
                    align="center"
                    width="150"
                    prop="taxExcludingPrice"
                  >
                    <template slot-scope="scope">
                      <el-input
                        size="small"
                        type="number"
                        min="0"
                        v-model="scope.row.taxExcludingPrice"
                        :disabled="fourthFlag"
                      ></el-input>
                    </template>
                  </el-table-column>
                  <el-table-column
                    label="合计(元)"
                    align="center"
                    width="150"
                    prop="taxExcludingPriceSum"
                  ></el-table-column>
                </el-table>
              </div>
            </el-tab-pane>
          </el-tabs>

          <div style="text-align:left;margin-left:40px;">
            <span style="font-size:18px;font-weight:500;">预算总造价：</span>
            <span style="font-size:18px;font-weight:500;color:#1abc9c;">{{budgetPrice}}</span>
          </div>
          <span slot="footer" class="dialog-footer">
            <el-button @click="baseConfig = false">取消</el-button>
            <el-button @click="saveThisProject">保存预结算</el-button>
          </span>
        </el-dialog>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "projectList",
  data() {
    return {
      ms_roleName: localStorage.getItem("roleName"),
      activeName: "first", //选项卡name值
      projectSearch: {
        info: "",
        type: "",
        date: "",
        progress: "",
        conName: ""
      }, //搜索框的值
      progress: [
        { name: "未立项", value: "01" },
        { name: "未派单", value: "2" },
        { name: "未进场", value: "3" },
        { name: "施工中", value: "4" },
        { name: "工程作业完工", value: "5" },
        { name: "工作量审核", value: "6" },
        { name: "验收", value: "7" },
        { name: "服开已归档", value: "71" },
        { name: "待交工", value: "72" },
        { name: "送审结算", value: "73" },
        { name: "竣工", value: "8" }
      ],
      projectInfo: [], //table数据
      Page: {
        RowCount: 1,
        CurrentPage: 1,
        PageSize: 10
      },

      //改派弹框
      dialogChoose: false,

      //审核意见弹窗的值
      ideaModel: {
        show: false,
        proId: "",
        remark: "",
        idea: ""
      },
      //改派弹窗数据
      changeOrder: {
        oldTeam: {},
        chooseTeam: "",
        type: "",
        options: [],
        teams: [],
        proId: ""
      },
      // 设置基础参数
      baseConfig: false,
      baseConfigInfo: {},
      // 表单验证
      rules: {
        skipfiber: [
          { required: true, message: "请输入跳纤点数量", trigger: "blur" }
        ],
        workDiscount: [
          { required: true, message: "请输入施工折扣率", trigger: "blur" }
        ],
        taxRate: [
          { required: true, message: "请输入施工单位税率", trigger: "blur" }
        ],
        slaTimeout: [{ required: true, message: " ", trigger: "change" }],
        macTon: [{ required: true, message: "请输入吨数", trigger: "blur" }],
        totalHouse: [
          { required: true, message: "请输入总户数", trigger: "blur" }
        ],
        materialInput: [
          {
            required: true,
            message: "请输入零星材料、资料录入",
            trigger: "blur"
          }
        ],
        disignerProvider: [{ required: true, message: " ", trigger: "change" }],
        dropPoint: [
          { required: true, message: "请输入降点数", trigger: "blur" }
        ],
        totalHouse: [
          { required: true, message: "请输入总户数", trigger: "blur" }
        ],
        surveyCost: [
          { required: true, message: "请输入勘察费", trigger: "blur" }
        ],
        homeBroadband: [{ required: true, message: " ", trigger: "change" }]
      },
      // 当前选中的项目id
      currentProId: "",
      // 概预算价格
      budgetPrice: "待计算",
      // 预结算弹窗的选项卡 name值
      budgetTabName: "first",
      // third 表三甲 乙 丙表格数据 表格title 表格编辑flag
      thirdInfo: [],
      thirdTwoInfo: [],
      thirdThreeInfo: [],
      thirdFlag: true,
      thirdTitle: "工程量预算表三甲",
      // fourth 表格数据
      fourthInfo: [],
      fourthFlag: true,
      fourthTitle: "甲供设备",
      //是否可编辑
      editBtn: true
    };
  },
  methods: {
    //标签页切换
    handleClick(tab, event) {
      this.Page = {
        RowCount: 1,
        CurrentPage: 1,
        PageSize: 10
      };
      this.projectSearch = {
        info: "",
        type: "",
        date: "",
        progress: ""
      };
      // 当选项卡切换的时候重置分页部分数据和条件查询，然后判断切换的哪一个标签页，来判断应该传什么状态像后端发起请求
      switch (tab.label) {
        case "全部项目":
          this.progress = [
            { name: "未立项", value: "01" },
            { name: "未派单", value: "2" },
            { name: "未进场", value: "3" },
            { name: "施工中", value: "4" },
            { name: "工程作业完工", value: "5" },
            { name: "工作量审核", value: "6" },
            { name: "验收", value: "7" },
            { name: "服开已归档", value: "71" },
            { name: "待交工", value: "72" },
            { name: "送审结算", value: "73" },
            { name: "竣工", value: "8" }
          ];
          // 全部项目
          break;
        case "已竣工":
          this.progress = [{ name: "竣工", value: "8" }];
          // 已竣工  -- 已完工
          break;
        case "施工中":
          this.progress = [
            { name: "未立项", value: "01" },
            { name: "未派单", value: "2" },
            { name: "未进场", value: "3" },
            { name: "施工中", value: "4" },
            { name: "工程作业完工", value: "5" },
            { name: "工作量审核", value: "6" },
            { name: "验收", value: "7" },
            { name: "服开已归档", value: "71" },
            { name: "待交工", value: "72" },
            { name: "送审结算", value: "73" }
          ];
          // 施工中  除了已完工的状态都算施工中
          break;
      }
      this.projectInit();
    },
    // 查询按钮
    searchInfo() {
      this.Page.CurrentPage = 1;
      this.projectInit();
    },
    //项目列表-查询
    projectInit() {
      let that = this,
        // let一个arr 如果条件查询框有值，就转化成数字塞入数组中，为空就赋值为progress的value值数组
        arr =
          that.projectSearch.progress === "" ||
          that.projectSearch.progress == null
            ? that.progress.map(item => {
                return item.value;
              })
            : [that.projectSearch.progress],
        suCb = res => {
          console.log("项目列表查询结果：", res);
          that.projectInfo = that.deepClone(res.data.data);
          // 把施工类型里面的字段拿出来用+拼接
          that.projectInfo.map(item => {
            if (item.majorType) {
              item.majorType = item.majorType.join("+");
            }
          });
          that.Page.RowCount = res.data.rowCount;
        },
        erCb = res => {},
        params = {
          pageCurrent: that.Page.CurrentPage,
          pageSize: that.Page.PageSize,
          info: that.projectSearch.info,
          type: that.projectSearch.type,
          date: that.projectSearch.date + "",
          progress: arr,
          conName: that.projectSearch.conName
        },
        req = {
          url: "/api/web/proProject/selectPro",
          methods: "post",
          data: params,
          success: suCb,
          error: erCb
        };
      console.log("项目列表查询参数：", params);
      that.$https(req);
    },
    //项目列表-查看详情
    handleCheck(id) {
      this.$router.push({
        name: "detailpro",
        params: {
          info: id,
          tabs: "first"
        }
      });
    },

    // 预算绘图 跳转
    goAmap() {
      localStorage.setItem("flags", 4);
      this.$router.push({ name: "amap" });
    },

    // 生成预结算
    makeBudget(proId) {
      this.$confirm("生成预结算请先配置基础参数！")
        .then(_ => {
          this.currentProId = proId;
          this.baseConfigSelect();
        })
        .catch(_ => {});
    },

    //项目列表-派单
    handleSendOrder(row, type) {
      this.$router.push({
        name: "sendInfos",
        params: {
          info: row,
          majorType: type
        }
      });
    },
    //项目列表-改派
    handleChangeOrder(team, id) {
      // 获取以后处理数据 渲染下拉框
      let arr = team.split("+");
      for (let i = 0; i < arr.length; i++) {
        arr[i] = { label: arr[i] };
      }
      this.changeOrder.options = arr;
      console.log("选择施工类型：", this.changeOrder.options);
      // 下拉框初始值回显
      this.changeOrder.type = this.changeOrder.options[0].label
        ? this.changeOrder.options[0].label
        : "";
      this.dialogChoose = true;
      this.changeOrder.proId = id;
      this.getOldTeam();
    },
    // 改派弹窗-下拉框  获取当前施工类型下的施工队信息，以及可选施工队下拉框数据
    getOldTeam() {
      let that = this,
        suCb = res => {
          console.log("可改派队伍查询结果：", res);
          that.changeOrder.teams = that.deepClone(res.data.outOldProTeam);
          that.changeOrder.oldTeam =
            that.deepClone(res.data.oldProTeam[0]) || {};
        },
        erCb = res => {},
        req = {
          url: "/api/web/proTeam/getProPT1",
          methods: "post",
          data: {
            proId: that.changeOrder.proId,
            majorType: that.changeOrder.type
          },
          success: suCb,
          error: erCb
        };
      console.log("可改派队伍查询参数：", req.data);
      that.$https(req);
    },
    // 改派提交按钮 事件处理函数
    submitChangeOrder() {
      let that = this,
        suCb = res => {
          console.log("改派提交结果：", res);
          if (res.data.flag == 1) {
            that.$msg("改派成功！");
            that.dialogChoose = false;
            that.projectInit();
          }
        },
        erCb = res => {
          console.log(res);
        },
        req = {
          url: "/api/web/proTeam/updatePT",
          methods: "post",
          data: {
            proId: that.changeOrder.proId,
            majorType: that.changeOrder.type,
            proTeamId: that.changeOrder.oldTeam.proTeamId,
            orgId: that.changeOrder.chooseTeam
          },
          success: suCb,
          error: erCb
        };
      console.log("改派提交参数：", req.data);
      if (req.data.proTeamId != "") {
        that.$https(req);
      } else {
        that.$erMsg("请选择改派施工队！");
      }
    },
    //项目列表-工作量审核
    handleWorkCheck(id) {
      this.$router.push({ name: "acceptDetail", params: { proId: id } });
    },

    //项目列表-工作量统计
    handleWorkTotal(id) {
      this.$router.push({ name: "examine", query: { proId: id } });
    },

    // 退料提醒
    handleReturn(id) {
      this.$confirm("确认提醒吗？")
        .then(_ => {
          let that = this,
            suCb = res => {
              that.$msg("提醒成功！");
              that.projectInit();
            },
            erCb = res => {
              console.log(res);
            },
            req = {
              url: "/api/web/proInStore/returnMatmsgRemind",
              methods: "post",
              data: {
                proId: id
              },
              success: suCb,
              error: erCb
            };
          that.$https(req);
        })
        .catch(_ => {});
    },
    // 审批意见
    handleIdea(id) {
      // this.ideaModel.show = true;
      // this.ideaModel.proId = id;
      let num;
      if (this.ms_roleName == "CenterClerk") {
        num = "311";
      } else if (this.ms_roleName == "CenterDeputy") {
        num = "321";
      } else if (this.ms_roleName == "CenterFinanceManager") {
        num = "331";
      } else if (this.ms_roleName == "CenterBOSS") {
        num = "531";
      }
      let that = this,
        suCb = res => {
          console.log("提交结果结果", res);
          if (res.data.flag == 1) {
            that.$msg("提交成功");
            that.projectInit();
          }
        },
        erCb = res => {
          console.log(res);
        },
        req = {
          url: "/api/web/proProject/AuditWorkLoadDetail",
          methods: "post",
          data: { proId: id, flowStep: num },
          success: suCb,
          error: erCb
        };
      console.log("提交参数", req.data);
      that.$https(req);
    },
    // 审批意见提交
    ideaCommit() {
      let num;
      if (ms_roleName == "CenterClerk" && this.ideaModel.idea == "true") {
        num = "000";
      } else if (
        ms_roleName == "CenterClerk" &&
        this.ideaModel.idea == "false"
      ) {
        num = "111";
      } else if (
        ms_roleName == "CenterDeputy" &&
        this.ideaModel.idea == "true"
      ) {
        num = "121";
      } else if (
        ms_roleName == "CenterDeputy" &&
        this.ideaModel.idea == "false"
      ) {
        num = "129";
      } else if (
        ms_roleName == "CenterFinanceClerk" &&
        this.ideaModel.idea == "true"
      ) {
        num = "311";
      } else if (
        ms_roleName == "CenterFinanceClerk" &&
        this.ideaModel.idea == "false"
      ) {
        num = "319";
      } else if (
        ms_roleName == "CenterFinanceManager" &&
        this.ideaModel.idea == "true"
      ) {
        num = "321";
      } else if (
        ms_roleName == "CenterFinanceManager" &&
        this.ideaModel.idea == "false"
      ) {
        num = "329";
      } else if (ms_roleName == "CenterBOSS" && this.ideaModel.idea == "true") {
        num = "531";
      } else if (
        ms_roleName == "CenterBOSS" &&
        this.ideaModel.idea == "false"
      ) {
        num = "539";
      } else {
        num = "0";
        console.log(this.ideaModel.idea);
      }
      let that = this,
        suCb = res => {
          console.log(res);
        },
        erCb = res => {
          console.log(res);
        },
        req = {
          url: "/api/web/proProject/checkedProJect",
          methods: "post",
          data: {
            proId: that.ideaModel.proId,
            number: num,
            errorDesc: that.ideaModel.remark
          },
          success: suCb,
          error: erCb
        };
      console.log(req.data);
      that.$https(req);
    },
    // 归档
    openFile(id) {
      let that = this,
        suCb = res => {
          console.log("归档结果：", res);
          that.$msg("归档成功");
          that.projectInit();
        },
        erCb = res => {},
        req = {
          url: "/api/web/proProject/changeProgress",
          methods: "post",
          data: { proId: id, proProgress: "8" },
          success: suCb,
          error: erCb
        };
      console.log("归档参数：", req.data);
      that.$https(req);
    },
    // 预结算弹窗  选项卡切换 处理函数
    budgetTabClick(tab, event) {
      if (this.budgetTabName == "first") {
        this.baseConfigSelect();
      } else if (this.budgetTabName == "fourth") {
        this.fourthTab();
      } else if (this.budgetTabName == "third") {
        this.thirdTab();
      }
      console.log(this.budgetTabName);
      this.editBtn = true;
    },
    // 设置基础参数 查询接口
    baseConfigSelect() {
      let that = this,
        suCb = res => {
          console.log(res);
          that.baseConfigInfo = res.data.data || {};
          that.baseConfig = true;
        },
        erCb = function(res) {
          console.log(res);
        },
        req = {
          url: "/api/web/proBudgetBaseConfig/selectProBudgetBaseConfig",
          methods: "post",
          data: { proId: that.currentProId },
          success: suCb,
          error: erCb
        };
      that.$https(req);
    },
    // 设置基础参数 提交接口
    submitForm(formName) {
      console.log(formName);
      let that = this;
      that.$refs[formName].validate(valid => {
        if (valid) {
          that.baseConfigUpdate();
        } else {
          console.log("error submit!!");
          return false;
        }
      });
    },
    // 提交请求
    baseConfigUpdate() {
      let that = this,
        suCb = res => {
          console.log(res);
          if (res.data.message == "ok") {
            that.$msg("设置基础参数成功,开始计算概预算");
            that.chooseThisPro(that.currentProId);
          }
        },
        erCb = function(res) {
          console.log(res);
        },
        req = {
          url: "/api/web/proBudgetBaseConfig/updateProBudgetBaseConfig",
          methods: "post",
          data: {
            proBudgetBaseConfig: that.baseConfigInfo,
            settlementType: "1"
          },
          success: suCb,
          error: erCb
        };
      that.$https(req);
    },
    // 选择该项目 计算预结算  拿到返回的预算总价
    chooseThisPro(id) {
      let that = this,
        suCb = res => {
          console.log(res);

          that.budgetPrice = res.data.B1_ex_15 || "待计算";
          that.$msg("计算预结算成功!");
        },
        erCb = function(res) {
          console.log(res);
          that.$erMsg("数据错误!");
        },
        req = {
          url: "/api/web/proBudgetTableCol/insertPreSettlementCount",
          methods: "post",
          data: { proId: id },
          success: suCb,
          error: erCb
        };
      // 如果当前类型是终结算 则调用另一个接口地址
      // todo：完成终结算后解除注释
      // if(that.currentType == '2'){
      //   req.url = "/api/web/proBudgetTableCol/insertEndSettlementCount"
      // }
      that.$https(req);
    },
    //3
    thirdTab() {
      let that = this;
      let suCb = function(res) {
        console.log(res.data);
        that.thirdInfo = that.deepClone(res.data.data);
      };
      let erCb = function(res) {
        console.log(res);
      };
      let palyParam = {
        url: "/api/web/proProject/queryTableThree",
        methods: "post",
        data: {
          proId: that.currentProId,
          // todo：完成终结算后解除注释
          // settlementType: that.currentType == "1" ? "1" : "2"
          settlementType: "1"
        },
        success: suCb,
        error: erCb
      };
      that.$https(palyParam);
    },
    // 表三甲 提交
    thirdCommitA() {
      if (!this.editBtn) {
        let that = this;
        let suCb = function(res) {
          console.log(res.data);
          that.$msg("保存成功");
          that.thirdFlag = !that.thirdFlag;
          that.editBtn = !that.editBtn;
          // 这里调用一下表一的接口是为了更新总价
          that.baseConfigInfo();
          that.thirdTab();
        };
        let erCb = function(res) {
          console.log(res);
        };
        let palyParam = {
          url: "/api/web/proTableThreeNail/updateTableThreeNail",
          methods: "post",
          data: {
            proId: that.currentProId,
            proTableThreeNail: that.thirdInfo,
            // settlementType: that.typeName == "typeOne" ? "1" : "2",
            settlementType: "1"
          },
          success: suCb,
          error: erCb
        };
        console.log(that.thirdInfo);
        that.$https(palyParam);
      }
    },
    //4
    fourthTab() {
      console.log(this.currentProId);
      let that = this;
      let suCb = function(res) {
        console.log(res.data);
        that.fourthInfo = that.deepClone(res.data.data);
      };
      let erCb = function(res) {
        console.log(res);
      };
      let postData = {
        proId: that.currentProId,
        matType: "0", // 0 1 2
        // todo：完成终结算后解除注释
        // settlementType: that.currentType == "1" ? "1" : "2"
        settlementType: "1"
      };
      // 根据表格标题的区别，判断传给后端的参数
      if (this.fourthTitle == "甲供设备") {
        postData.matType = "0";
      } else if (this.fourthTitle == "甲供主材") {
        postData.matType = "1";
      } else {
        postData.matType = "2";
      }
      let palyParam = {
        url: "/api/web/proBudgetMaterial/selectPreBudgetMaterial",
        methods: "post",
        data: postData,
        success: suCb,
        error: erCb
      };
      that.$https(palyParam);
    },
    // 表四 提交
    fourthCommit() {
      if (!this.editBtn) {
        // 深拷贝表格数据，并且对需要计算的单元格数据进行处理
        let param = this.deepClone(this.fourthInfo).map(item => {
          return {
            matId: item.matId,
            num: item.num,
            taxExcludingPrice: item.taxExcludingPrice,
            taxExcludingPriceSum: item.taxExcludingPrice * item.num,
            budgetId: item.budgetId
          };
        });
        console.log(param);
        let that = this;
        let suCb = function(res) {
          console.log(res.data);
          that.$msg("保存成功");
          that.fourthFlag = !that.fourthFlag;
          that.editBtn = !that.editBtn;
          // 这里调用一下表一的接口是为了更新总价
          that.baseConfigInfo();
          that.fourthTab();
        };
        let erCb = function(res) {
          console.log(res);
        };
        let palyParam = {
          url: "/api/web/proBudgetMaterial/updateProBudgetMaterial",
          methods: "post",
          data: {
            proId: that.currentProId,
            proBudgetMaterial: param,
            // settlementType: that.typeName == "typeOne" ? "1" : "2"
            settlementType: "1"
          },
          success: suCb,
          error: erCb
        };
        that.$https(palyParam);
      }
    },
    // 下拉菜单 事件处理函数
    handleCommand1(command) {
      if (command == "甲供设备" || "甲供主材" || "乙供主材") {
        this.budgetTabName = "fourth";
      }

      if (this.budgetTabName == "fourth") {
        this.fourthTitle = command;
        this.fourthTab();
      }
    },
    // 编辑按钮 事件处理函数
    edit(tab) {
      switch (tab) {
        case 3:
          this.thirdFlag = !this.thirdFlag;
          break;
        case 4:
          this.fourthFlag = !this.fourthFlag;
          break;
      }
      this.editBtn = !this.editBtn;
    },
    commit(tab) {
      switch (tab) {
        case 3:
          this.thirdCommitA();
          break;
        case 4:
          this.fourthCommit();
          break;
      }
    },
    setBaseConfig(tab) {
      this.baseConfig = true;
    },
    // 保存该项目
    saveThisProject() {
      // console.log(this.currentProId, this.currentType);
      // if (this.currentType == "1") {
      //   //  保存预结算以后跳转至结算项目列表 且类型为预结算
      //   if (this.currentProId) {
      this.$confirm("确认保存吗？确认后将不能再次修改！")
        .then(_ => {
          let that = this;
          let suCb = function(res) {
            console.log(res.data);
            that.$msg("保存预结算成功");
            that.$router.push({
              name: "finalCostTable",
              query: { proType: "1" }
            });
          };
          let erCb = function(res) {
            console.log(res);
          };
          let palyParam = {
            url: "/api/web/proProject/updateProProgressStatus",
            methods: "post",
            data: {
              proId: that.currentProId,
              settlementStatus: "1"
            },
            success: suCb,
            error: erCb
          };
          that.$https(palyParam);
        })
        .catch(_ => {});
      //     } else {
      //       this.$erMsg("请先选择项目并进行数据修改！");
      //     }
      //   } else {
      //     //  保存预结算以后跳转至结算项目列表 且类型为终结算
      //     this.$confirm("确认保存吗？确认后将不能再次修改！")
      //       .then(_ => {
      //         let that = this;
      //         let suCb = function(res) {
      //           console.log(res.data);
      //           that.$msg("保存终结算成功");
      //           that.$router.push({
      //             name: "finalCostTable",
      //             query: { proType: "2" }
      //           });
      //         };
      //         let erCb = function(res) {
      //           console.log(res);
      //         };
      //         let palyParam = {
      //           url: "/api/web/proProject/updateProProgressStatus",
      //           methods: "post",
      //           data: {
      //             proId: that.currentProId,
      //             settlementStatus: "2"
      //           },
      //           success: suCb,
      //           error: erCb
      //         };
      //         that.$https(palyParam);
      //       })
      //       .catch(_ => {});
      //   }
    }
  },
  created() {
    this.projectInit();
  }
};
</script>

<style scoped>
.component-projectList .tabs-header {
  width: 1150px;
  box-sizing: border-box;
  margin: 20px auto 0;
}

.component-searchHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
}

.component-searchHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-searchHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  line-height: 45px;
  font-family: "微软雅黑";
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-searchHeader .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 30px;
}

.component-searchHeader .right button {
  padding: 0 25px;
  height: 30px;
  margin: 8px 5px;
  line-height: 30px;
  font-size: 14px;
  color: #666;
  background-color: #fff;
  border: 1px solid #ccc;
}

.component-searchHeader .right button:hover {
  background-color: #f3f3f3;
}
.component-search-box {
  width: 1100px;
  box-sizing: border-box;
  background-color: #fff;
  border: 1px solid #e4e4e4;
  border-top: none;
  margin: 0 auto;
  text-align: left;
  padding-left: 30px;
  line-height: 60px;
  padding-bottom: 15px;
  padding-top: 15px;
}
.component-search-box .el-input__inner {
  height: 35px;
  display: inline-block;
}
.el-form-item {
  margin-bottom: 0;
}
.component-listHeader .search-header {
  width: 1100px;
  box-sizing: border-box;
  border: 1px solid rgba(228, 228, 228, 1);
  border-bottom: none;
  background-color: rgba(255, 255, 255, 1);
  margin: 20px auto 0;
}

.component-listHeader .search-header .left-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  background-color: rgba(243, 243, 243, 1);
  height: 45px;
  box-sizing: border-box;
}

.component-listHeader .search-header .left-title .left-text {
  width: 20%;
  color: #666;
  line-height: 45px;
  font-family: "微软雅黑";
  font-weight: 400;
  font-size: 12px;
  text-align: left;
  margin: 0 0 0 30px;
}

.component-listHeader .search-header .right {
  width: 70%;
  display: flex;
  justify-content: flex-end;
  margin-right: 10px;
}

.component-listHeader .search-header .right button {
  padding: 0 15px;
  height: 30px;
  width: 110px;
  margin: 6px 5px;
  line-height: 30px;
  font-size: 14px;
  color: #1abc9c;
  background-color: #fff;
  border: 1px solid #ccc;
}
.el-form-item {
  width: 310px;
}
.component-listHeader .search-header .right button:hover {
  background-color: #1abc9c;
  color: #fff;
}
.component-listHeader .search-header .right .right-select-margin {
  margin-top: 8px;
  margin-right: 8px;
}
/* 删除按钮 */
.red {
  color: #48c9b0;
  font-size: 12px;
}

/* 下载列表 */
.download-list {
  width: 100%;
  margin: 20px auto;
  display: flex;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.download-list > div:first-child {
  width: 25%;
}

.download-list > div:first-child > span {
  width: 100%;
  padding-right: 10px;
  font-size: 14px;
  text-align: right;
}

.component-models .el-form-item {
  width: 512px;
  margin-bottom: 10px;
}
.component-models .el-select {
  left: -50px;
}

.el-textarea {
  display: block;
  margin-top: 13px;
}

/* --------------------------------------预结算------------------------------- */
.component-makeBudget .tabs-header {
  width: 750px;
  box-sizing: border-box;
  margin: 0 auto 0;
}

.fl_container {
  display: flex;
  justify-content: space-between;
  margin-bottom: 15px;
}
.fl_container .fl_left {
  text-align: left;
}
.fl_container .fl_right {
  text-align: right;
}

/* 表格部分 */
.budget {
  margin-top: 20px;
  width: 100%;
  overflow: hidden;
  background: #f8f8f8;
  height: 35px;
  line-height: 35px;
  font-size: 14px;
  border: 1px solid #e4e4e4;
  border-bottom: none;
  padding: 0 20px;
  box-sizing: border-box;
  font-size: 14px;
  color: #666;
}
.gcl .title {
  background: #f8f8f8;
  height: 35px;
  line-height: 35px;
  color: #666;
  padding: 0 20px;
  font-size: 14px;
  border: 1px solid #e4e4e4;
  border-bottom: none;
  text-align: left;
}
.budget .title {
  float: left;
}
.budget div:last-of-type {
  float: right;
}
.gcl .tabs {
  width: 710px;
  margin: 20px;
  box-sizing: border-box;
}

.budgetTable table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  margin: 0;
  padding: 0;
  border: none;
  font-size: 12px;
}

.gcl_footer {
  text-align: right;
  margin: 20px 0 0 0;
}

.gcl_footer .gcl_footer_bottom span {
  color: #1abc9c;
}

.gcl_footer .gcl_footer_bottom {
  margin-bottom: 10px;
  margin-right: 2px;
  font-size: 19px;
}

.component-projectList .component-budgetModel .tabs-header {
  width: 750px;
  box-sizing: border-box;
  margin: 0 auto 30px;
}
</style>

